#include <hidef.h>
#include "derivative.h"
#include "atd.h"

void atd_init(void) {  
  ATD0CTL3 = 0x08;
  ATD0CTL4 = 0x80;
  ATD0CTL5 = 0x20;
  ATD0DIEN = 0x01;
}

int atd_getValue(void) {
  while(ATD0STAT0 != 0x80){
	  return ATD0DR0H;
  }
}